package cn.org.timespace.easyframe.util.sms.telecom;

import java.io.UnsupportedEncodingException;
import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.huawei.insa2.comm.smgp.message.SMGPDeliverMessage;

public class DeliverMsg {
	private final static Log log = LogFactory.getLog(MySMGPSMProxy.class);
	
	/**
	 * ��Ϣ����
	 */
	public void ProcessRecvDeliverMsg(SMGPDeliverMessage msg) {
//		byte[] msgId = msg.getMsgId();// ����Ϣ��ˮ��
		String srcTermId = msg.getSrcTermID();// ��Ϣ�����ߺ���
		byte[] content = msg.getMsgContent();// ��Ϣ����
//		String destTermId = msg.getDestTermID();// ���Ž��պ���
//		int isReport = msg.getIsReport();// �Ƿ�Ϊ״̬����
//		int msgFormat = msg.getMsgFormat();// ����Ϣ��ʽ
//		int msgLength = msg.getMsgLength();// ����Ϣ����
		Date recvTime = msg.getRecvTime();// ����Ϣ����ʱ��
		// String reserve = msg.getReserve();//����

		String contentStr = "";

		String encode = "ISO8859-1";
		if (msg.getMsgFormat() == 8)
			encode = "iso-10646-ucs-2";
		if (msg.getMsgFormat() == 15)
			encode = "GB2312";
		try {
			contentStr = new String(content, encode);
			log.info("�յ��û�����:" + contentStr);
			//System.out.println("�յ��û�����:" + contentStr);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		//������ѻ��������
	}

	public void Terminate() {
		// ����l��
		SendReceiveInterface inter = SendReceiveInterface.getInstance();
		inter.ReceiveInstance();
		
	}


}
